package com.ruoyi.api;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.ruoyi.api.common.R;
import com.ruoyi.api.domain.EcUser;
import com.ruoyi.api.domain.LDAPLoginDTO;
import com.ruoyi.api.domain.LoginDTO;
import com.ruoyi.api.factory.RemoteAuthServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * 认证服务
 *
 * @author ruoyi
 */
@FeignClient(contextId = "remoteAuthService", value = "ruoyi-auth",fallbackFactory = RemoteAuthServiceFallbackFactory.class)
public interface RemoteAuthService
{

    /**
     * LDAP登录返回ticket
     * @param dto
     * @return
     */
    @PostMapping(value = "/ldapLogin",consumes = MediaType.APPLICATION_JSON_VALUE)
    R<String> ldapLogin(@RequestBody LDAPLoginDTO dto);

    /**
     * 根据ticket返回用户信息
     * @param ticket
     * @return
     */
    @PostMapping(value = "/getUserInfoByTicket")
    R<LoginDTO> getUserInfoByTicket(@RequestParam("ticket") String ticket);

}
